﻿#region zh-CHS 2006 - 2008 DemoSoft 团队 | en 2006 - 2008 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the MMOSE(Massively Multiplayer Online Server Engine) for .NET.
//
//                              2006-2008 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
using Demo.Mmose.Core.Common.SupportSlice;
using Demo.Mmose.Core.Entity.Character;
using Demo.Mmose.Core.Entity.Creature;
using Demo.Mmose.Core.Entity.Item;
using Demo.Mmose.Core.Map;
#endregion

namespace Demo.Mmose.Core.World
{
    /// <summary>
    /// 
    /// </summary>
    public class MmorpgWorld<MapT, ItemT, ItemTemplateT, CreatureT, CreatureTemplateT, CharacterT> : BaseWorld
        where MapT : BaseMap
        where ItemT : BaseItem
        where ItemTemplateT : BaseItemTemplate
        where CreatureT : BaseCreature
        where CreatureTemplateT : BaseCreatureTemplate
        where CharacterT : BaseCharacter
    {
        #region zh-CHS 私有常量 | en Private Constants
        /// <summary>
        /// 
        /// </summary>
        private readonly static int HANDLER_CAPACITY_SIZE = 1024;
        #endregion

        #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
        /// <summary>
        /// 
        /// </summary>
        public MmorpgWorld()
        {
            base.EventStartSlice += new EventHandler<BaseWorldEventArgs>( this.StartSlice );
        }
        #endregion

        #region zh-CHS 共有属性 | en Public Properties

        #region zh-CHS Map属性 | en Map Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private MapHandler<MapT> m_MapHandler = new MapHandler<MapT>( HANDLER_CAPACITY_SIZE );
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public MapHandler<MapT> MapHandler
        {
            get { return m_MapHandler; }
            protected set { m_MapHandler = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private SliceUpdate<MapT> m_MapSliceUpdate = new SliceUpdate<MapT>();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public SliceUpdate<MapT> MapSliceUpdate
        {
            get { return m_MapSliceUpdate; }
        }

        #endregion

        #region zh-CHS Item属性 | en Item Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private ItemHandler<ItemT> m_ItemHandler = new ItemHandler<ItemT>( HANDLER_CAPACITY_SIZE );
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public ItemHandler<ItemT> ItemHandler
        {
            get { return m_ItemHandler; }
            protected set { m_ItemHandler = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private ItemTemplateHandler<ItemTemplateT> m_ItemTemplateHandler = new ItemTemplateHandler<ItemTemplateT>( HANDLER_CAPACITY_SIZE );
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public ItemTemplateHandler<ItemTemplateT> ItemTemplateHandler
        {
            get { return m_ItemTemplateHandler; }
            protected set { m_ItemTemplateHandler = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private SliceUpdate<ItemT> m_ItemSliceUpdate = new SliceUpdate<ItemT>();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public SliceUpdate<ItemT> ItemSliceUpdate
        {
            get { return m_ItemSliceUpdate; }
        }

        #endregion

        #region zh-CHS Creature属性 | en Creature Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private CreatureHandler<CreatureT> m_CreatureHandler = new CreatureHandler<CreatureT>( HANDLER_CAPACITY_SIZE );
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public CreatureHandler<CreatureT> CreatureHandler
        {
            get { return m_CreatureHandler; }
            protected set { m_CreatureHandler = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private CreatureTemplateHandler<CreatureTemplateT> m_CreatureTemplateHandler = new CreatureTemplateHandler<CreatureTemplateT>( HANDLER_CAPACITY_SIZE );
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public CreatureTemplateHandler<CreatureTemplateT> CreatureTemplateHandler
        {
            get { return m_CreatureTemplateHandler; }
            protected set { m_CreatureTemplateHandler = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private SliceUpdate<CreatureT> m_CreatureSliceUpdate = new SliceUpdate<CreatureT>();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public SliceUpdate<CreatureT> CreatureSliceUpdate
        {
            get { return m_CreatureSliceUpdate; }
        }

        #endregion

        #region zh-CHS Character属性 | en Character Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private CharacterHandler<CharacterT> m_CharacterHandler = new CharacterHandler<CharacterT>( HANDLER_CAPACITY_SIZE );
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public CharacterHandler<CharacterT> CharacterHandler
        {
            get { return m_CharacterHandler; }
            protected set { m_CharacterHandler = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private SliceUpdate<CharacterT> m_CharacterSliceUpdate = new SliceUpdate<CharacterT>();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public SliceUpdate<CharacterT> CharacterSliceUpdate
        {
            get { return m_CharacterSliceUpdate; }
        }

        #endregion

        #endregion

        #region zh-CHS 私有的事件处理函数 | en Private Event Handlers
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEventArgs"></typeparam>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StartSlice( object sender, BaseWorldEventArgs eventArgs )
        {
            m_MapSliceUpdate.Slice();

            m_ItemSliceUpdate.Slice();

            m_CreatureSliceUpdate.Slice();

            m_CharacterSliceUpdate.Slice();
        }
        #endregion
    }

    /// <summary>
    /// 
    /// </summary>
    public class MmorpgWorld : MmorpgWorld<BaseMap, BaseItem, BaseItemTemplate, BaseCreature, BaseCreatureTemplate, BaseCharacter>
    {
        // default
    }
}
#endregion